<?php
    App::import('Vendor', 'libchart', array('file'=>'libchart'.DS.'classes'.DS.'libchart.php'));
    class GraphHelper extends AppHelper {
        function showChart($chartTitle, $chartData)
        {
            header("Content-type: image/png");
            $chart = new HorizontalBarChart(300, 250);

            $dataSet = new XYDataSet();

            foreach ($chartData as $xLabel => $yValue) {
                $dataSet->addPoint(new Point($xLabel, $yValue));
             }

            $chart->setDataSet($dataSet);
            $chart->getPlot()->setGraphPadding(new Padding(5, 15, 15, 100));
            $chart->getPlot()->setLogoFileName(null); // get rid of the annoying logo

            $chart->setTitle($chartTitle);
            $chart->render();
        }
        function sayhi($chartTitle, $chartData) {
        	header("Content-type: image/png");
        	$chart = new HorizontalBarChart(300, 250);

            $dataSet = new XYDataSet();

            foreach ($chartData as $xLabel => $yValue) {
                $dataSet->addPoint(new Point($xLabel, $yValue));
             }

            $chart->setDataSet($dataSet);
            $chart->getPlot()->setGraphPadding(new Padding(5, 15, 15, 100));
            $chart->getPlot()->setLogoFileName(null); // get rid of the annoying logo
			 
            $chart->setTitle($chartTitle);
           
            $chart->render();
        }
    }
?>